package com.lx.patterns.facade;

/**
 * @ClassName SmartAppliancesFacade
 * @Description: //
 * @Author: 落雪
 * @CreateDate: 2025/1/25 17:53
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/1/25 17:53
 * @UpdateRemark:
 * @Version: 1.0
 */
public class SmartAppliancesFacade {

    private Light light;

    private TV tv;

    private AirCondition airCondition;

    public SmartAppliancesFacade() {
        light = new Light();
        tv = new TV();
        airCondition = new AirCondition();
    }

    public void say(String message){
        if(message.contains("打开")){
            on();
        }else if (message.contains("关闭")){
            off();
        }else {
            System.out.println("请输入正确的提示词");
        }

    }

    private void on(){
        light.on();
        tv.on();
        airCondition.on();
    }
    private void off(){
        light.off();
        tv.off();
        airCondition.off();
    }
}
